let traceAll = require('./trace');
traceAll = JSON.parse(traceAll);


var aa = `输入油门	输入转向	输入挡位	输入刹车	返回油门	返回转向	返回挡位	返回刹车	返回速度	观测经度	观测纬度	观测偏北角	观测高程	观测速度	计算坡度	计算速度偏差	计算加速度偏差	error	ψe	ψθ	ψss	ψyaw	ψi	id	曲率
pedal_in_record	steering_in_record	gearbox_in_record	brake_in_record	pedal_back_record	steering_back_record	gearbox_back_record	brake_back_record	speed_back_record	longitude_measure_record	latitude_measure_record	north_measure_record	height_measure_record	speed_measure_record	slope_cal_record	e_cal_record	ec_cal_record	phi_e_cal_record	phi_error_cal_record	phi_thata_cal_record	phi_ss_cal_record	phi_yaw_cal_record	phi_i_cal_record	phi_ind_cal_record	cur_measure_record
`
var t = aa.split(/\t|\n/)
var tt = t.filter(item =>item)

let res = {}; for(let i = 49; i >=25 ; --i) { res[tt[i]] = tt[i-25]}

let keys = Object.keys(res);

let infoAll = traceAll.reduce((prev, item) => {
    let obj =  keys.reduce((prev, key) => {
        prev[key] = Math.random() * 10;
        return prev;
    }, {});

    obj.latitude_measure_record = item.lat;
    obj.longitude_measure_record = item.lng;
    prev.push(obj);
    return prev;
}, []);

module.exports = infoAll;

